package com.vivachek.protocol.enums

import com.vivachek.protocol.exception.NotSupportProtocolException

/**
 * @Author: YCB
 * @Time: 2022/9/29 15:20
 * @Email: congbin.yuan@vivachek.com
 * @Description: 报警码枚举
 *
 */
enum class WarnCodeEnums(val type: Int, val warnCode: String, val desc: String) {
    E1(1, "E1", "请在出现等待加血界面之后加样"),
    E2(2, "E2", "试纸已被使用，请更换新试纸重新测试"),
    E3(3, "E3", "血糖试纸不匹配,请更换新的血糖试纸测试"),
    E4(4, "E4", "样本异常,只有人体血液和配套的质控液可用于测试"),
    E5(5, "E5", "请移至合适的温度环境中，等待20分钟后重新检测"),
    E6(6, "E6", "设备异常,请重启血糖仪更换新试纸测试"),
    E7(7, "E7", "请更换新试纸重新测试,检测样本加样不足"),
    E8(8, "E8", "请拔掉血糖仪充电线，重新插条开机，进行血糖测试"),
    E10(10, "E10", "请更换新试纸重新测试，并确保加样充足"),
    E11(11, "E11", "设备电池电量不足"),

    ;

    companion object {
        fun convert(type: Int): WarnCodeEnums {
            values().forEach {
                if (it.type == type) {
                    return it
                }
            }
            throw NotSupportProtocolException("无法解析设备反馈的错误码")
        }
    }
}